03 May 2024

feedDjango community aggregator: Community blog posts

Weeknotes (2024 week 18)

Weeknotes (2024 week 18)

Google Summer of Code has begun

We have a student helping out with adding async support to the Django Debug Toolbar. It's great that someone can spend some concentrated time to work on this. Tim and others have done all the necessary preparation work, I'm only helping from the sidelines so don't thank me.

Bike to Work

Two teams from my company are participating in the Bike to Work Challenge 2024. It's what I do anyway (if I'm not working from home) but maybe it helps build others some motivation to get on the bicycle once more. Public transports in the city where I live are great but I'll always take the bike when I can. I also went on my first mountain bike ride in a few months yesterday, good fun.

JSON blobs and referential integrity

The django-json-schema-editor has gained support for referencing Django models. Here's an example schema excerpt:

{
    ...
    "articles": {
        "type": "array",
        "format": "table",
        "title": _("articles"),
        "minItems": 1,
        "maxItems": 3,
        "items": {
            "type": "string",
            "title": _("article"),
            "format": "foreign_key",
            "options": {
                "url": "/admin/articles/article/?_popup=1&_to_field=id",
            },
        },
    },
    ...
}

The ID field is stringly typed; using an integer directly wouldn't work because the empty string isn't a valid integer.

The problem with referencing models in this way is that there's no way to know if the referenced object is still around or not, or even to protect it against deletion. The bundled django-content-editor JSONPlugin now supports automatically generating a ManyToManyField with a through model which protects articles from deletion as long as they are referenced from a JSONPlugin instance. The register_reference line creates the mentioned model with an on_delete=models.PROTECT foreign key to articles and a post_save handler which updates said references.

from django_json_schema_editor.plugins import JSONPluginBase, register_reference
from articles.models import Article

class JSONPlugin(JSONPluginBase, ...):
    pass

register_reference(JSONPlugin, "articles", Article)

Releases since the beginning of April

03 May 2024 5:00pm GMT

Django News - New Django Ops Team Member - May 3rd 2024

News

June 2024 marks 10 incredible years of Django Girls magic! 🥳✨

Join the celebration as Django Girls turns 10 🎉 and share your experiences in our survey!

djangoproject.com

DEFNA: Board Member Update for May 2024

Velda Kiara joins the DEFNA board, and we wish Jennifer Myers a heartfelt thank you for three years of service.

defna.org

Django Software Foundation

Welcome our new OPS member - Baptiste Mispelon

The DSF Board is pleased to introduce Baptiste Mispelon as a new member of the Ops team that maintains Django's infrastructure.

djangoproject.com

Updates to Django

Today 'Updates to Django' is presented by Velda Kiara from Djangonaut Space!

Last week we had 11 pull requests merged into Django by 10 different contributors - including 5 first-time contributors! Congratulations to Chris Muthig, Saurabh , James Ostrander, Tim Richardson, and Cole D for having their first commits merged into Django - welcome on board!

Django 5.0.5 got a bug fix. You can now import aprefetch_related_objects from django.db.models

Djangonaut Space Session 2 is still open and accepting applications. Read more about it here and apply.

Django Newsletter

Wagtail CMS

Get even more organized with Wagtail 6.1

An overview of what's new in Wagtail 6.1.

wagtail.org

How to Use ModelAdmin with Wagtail CMS v6+

As of Wagtail v6, the powerful ModelAdmin feature has been removed, but if you have extensive custom code reliant on ModelAdmin, you can use a separate package called wagtail-modeladmin.

timonweb.com

Sponsored Ad

crunchydata.com

Articles

Django: An admin extension to prevent state leaking between requests

A small protection to add to your Django projects.

adamj.eu

Django from first principles

Many people don't realize you can start a Django project with a single file. This series walks through building a simple but non-trivial project by starting with a single file.

mostlypython.com

Start Charging Customers with Django and DjStripe

Use the popular Dj-Stripe package to start collecting payments with about 10 minutes of set up.

circumeo.io

Create a Django model index with an upper case empty string condition

James Beith shares a technique for creating a conditional database index.

jamesbeith.co.uk

How an empty S3 bucket can make your AWS bill explode

Imagine you create an empty, private AWS S3 bucket in a region of your preference. What will your AWS bill be the next morning?

hostux.net

Events

Meet PyCon US Keynote Speakers

This year's PyCon US keynote speakers are Jay Miller, Kate Chapman, Simon Willison, and Sumana Harihareswara.

blogspot.com

DjangoCon Europe 2024 schedule is up

The DjangoCon Europe 2024 schedule is up and features three days of talks and workshops.

evolutio.pt

Design Articles

Adactio: Journal-My approach to HTML web components

A deep-dive into HTML web components: naming custom elements, naming attributes, the single responsibility principle, and communicating across components.

adactio.com

Tutorials

Building Reusable Components in Django

Build server-side UI components using django-viewcomponent.

testdriven.io

Sponsored Link

Free Trial of Scout APM Today!

Need answers to your Django app questions fast? Avoid the hassle of talking with a sales rep and the long wait times of large support teams, and choose Scout APM. Get Django insights in less than 4 minutes with Scout APM.

scoutapm.com

Podcasts

Django Chat #162: Self-Hosted Open Source - Michael Kennedy

Michael hosts the Talk Python podcast, co-hosts Python Bytes, and runs courses at Talk Python Training. We discuss his recent shift to mainly self-hosted open-source options for everything from marketing emails to analytics and more.

djangochat.com

Django News Jobs

Principal Backend Software Engineer at Monitaur 🆕

Senior Full Stack Software Engineer at Monitaur 🆕

Senior AI Engineer (f/m/d) at 1&1

Michigan Online Software Engineer at University of Michigan

Web developer at der Freitag Mediengesellschaft

Backend Software Architect, EarthRanger (Contract Opportunity) at AI2

Senior Software Engineer (backend) - IASO at Bluesquare

Django Newsletter

Projects

rails-inspire-django/django-viewcomponent

Build reusable components in Django, inspired by Rails ViewComponent.

If you have been looking for a way to build reusable components in Django, this is worth checking out.

github.com

edoburu/django-any-urlfield

An improved URL selector to choose between internal models and external URLs.

github.com

pydanny/dj-notebook

Django + shell_plus + Jupyter notebooks made easy.

github.com


This RSS feed is published on https://django-news.com/. You can also subscribe via email.

03 May 2024 3:00pm GMT

Building Reusable Components in Django

This tutorial looks at how to build server-side UI components in Django.

03 May 2024 3:28am GMT